<!--{template ADMIN_DIRECTORY/tpl/admin_header}-->
 <div class="page_title">
    	<h1>{if $type=='about'}页脚配置{else}{$_lang['article']}{/if}{$_lang['manage']}</h1>
        <div class="tool">
            <a href="index.php?do=$do&view=list&type=$type" {if $view=='list'}class="here" {/if}>{if $type=='art'}{$_lang['article']}{elseif $type=='help'}{$_lang['help']}{elseif $type=='bulletin'}{$_lang['bulletin']}{elseif $type=='about'}页脚列表{else}{$_lang['single_page']}{/if}{$_lang['list']}</a>
            <a href="index.php?do=$do&view=edit&type=$type" {if $view=='edit'}class="here" {/if}>{if $type=='art'}{$_lang['article']}{elseif $type=='help'}{$_lang['help']}{elseif $type=='bulletin'}{$_lang['bulletin']}{elseif $type=='about'}添加页脚{else}{$_lang['single_page']}{/if}{if $art_id}{$_lang['edit']}{else}{$_lang['add']}{/if}</a>
    	</div>
</div>
<!--页头结束-->
<div class="box post">
    <div class="tabcon">
        	<div class="title"><h2>{if $art_id}{$_lang['edit']}{else}{$_lang['add']}{/if}{if $type=='art'}{$_lang['article']}{elseif $type=='help'}{$_lang['help']}{elseif $type=='bulletin'}{$_lang['bulletin']}{elseif $type=='about'}页脚{else}{$_lang['single_page']}{/if}</h2></div>
            <div class="detail">
                <form method="post" action="index.php?do={$do}&view={$view}" id="frm_art_edit" enctype="multipart/form-data">
                <input type="hidden" name="pk[art_id]" value="{$art_info['art_id']}" id='art_id'>
                <input type="hidden" name="type" value="{$type}">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">

                      <tr>
                        <th scope="row" width="130">{if $type=='art'}{$_lang['article']}{elseif $type=='help'}{$_lang['help']}{elseif $type=='bulletin'}{$_lang['bulletin']}{elseif $type=='about'}页脚{else}{$_lang['single_page']}{/if}{$_lang['title']}{$_lang['zh_mh']}</th>
                        <td>
	                        <input type="text" name="fields[art_title]" id="txt_art_title"  value="{$art_info['art_title']}" maxlength="100"  class="txt" style=" width:260px;"
	                        limit="required:true;len:3-100;general:false"
	                        msg="{if $type=='art'}{$_lang['article']}{elseif $type=='help'}{$_lang['help']}{elseif $type=='bulletin'}{$_lang['bulletin']}{elseif $type=='about'}{$_lang['about']}{else}{$_lang['single_page']}{/if}{$_lang['some_restrictions_about_title']}"
	                        msgArea="art_title_msg"
	                        title='{$_lang['please_input']}{if $type=='art'}{$_lang['article']}{elseif $type=='help'}{$_lang['help']}{else}{$_lang['single_page']}{/if}{$_lang['the_title']}' />
	                        <span id="art_title_msg"></span>
                        </td>
                      </tr>
                      {if $type=='art' or $type=='help'}
                      <tr>
                        <th scope="row">{if $type=='art'}{$_lang['article']}{elseif $type=='help'}{$_lang['help']}{elseif $type=='bulletin'}{$_lang['bulletin']}{elseif $type=='about'}页脚{else}{$_lang['single_page']}{/if}{$_lang['category']}{$_lang['zh_mh']}</th>
                        <td>
                         <select name="fields[art_cat_id]" id="slt_cat_id" style=" width:270px;"
                         			 limit = "required:true;type:int"
                                     msg = '{$_lang['please_choose']}{if $type=='art'}{$_lang['article']}{elseif $type=='help'}{$_lang['help']}{else}{$_lang['single_page']}{/if}{$_lang['category']}'
                                     title='{$_lang['choose_which_category']}{if $type=='art'}{$_lang['article']}{elseif $type=='help'}{$_lang['help']}{else}{$_lang['single_page']}{/if}{$_lang['zh_wh']}'
                                     msgArea="msg_cat_id">
							{if $type == 'help'}<option value="">请选择分类下的子类</option>{/if}
	                        {loop $cat_arr $k $v}
								{if $k>0}
								$v
							<!--	<optgroup {if $v['art_cat_pid'] == '0'} label="$v['cat_name']"{/if}>
									{if $v['art_cat_pid'] == '381'}
									<option value="$k">$v['cat_name']</option>
									{/if}
									{if $v['art_cat_pid'] == '294'}
									<option value="$k">$v['cat_name']</option>
									{/if}
									{if $v['art_cat_pid'] == '293'}
									<option value="$k">$v['cat_name']</option>
									{/if}
									{if $v['art_cat_pid'] == '291'}
									<option value="$k">$v['cat_name']</option>
									{/if}
								</optgroup>

								-->
								{/if}
	                        {/loop}

	                     </select>
	                     <span id="msg_cat_id"></span>
						 {if $type=='help'}<span>请勿选择父级分类，添加在父级分类下的帮助会无法在帮助中心展示</span>{/if}
	                	</td>

                      </tr>
					 {/if}

                      <tr>
                        <th scope="row">{$_lang['order']}{$_lang['zh_mh']}</th>
                        <td>
                         <input type="text"  class="txt" style=" width:260px;"
						  id="txt_listorder" name="fields[listorder]"
						   value="{if $listorder}$listorder{else}0{/if}"
						    maxlength="5"
								limit = "required:true;type:int"
                                onkeyup="clearstr(this)"
                                msg = '{$_lang['please_input']}{if $type=='art'}{$_lang['article']}{elseif $type=='help'}{$_lang['help']}{elseif $type=='bulletin'}{$_lang['bulletin']}{elseif $type=='about'}{$_lang['about']}{else}{$_lang['single_page']}{/if}{$_lang['order']}'
                                title='{if $type=='art'}{$_lang['article']}{elseif $type=='help'}{$_lang['help']}{else}{$_lang['single_page']}{/if}{$_lang['order']}'
                                msgArea="slt_txt_listorder"/><span id="slt_txt_listorder"></span>
                        </td>
                      </tr>
 					{if $type!='about'}
                      <tr>
                        <th scope="row">{$_lang['author']}{$_lang['zh_mh']}</th>
                        <td> <input type="text" class="txt" style=" width:260px;"
						 name="fields[username]" id="txt_username"
						 value="{$art_info['username']}"
                        			 limit = "required:false"
                                     msg = '{$_lang['please_input_author']}'
                                     title='{$_lang['please_input_your_author']}'
                                     msgArea="msg_txt_username"/><span id="msg_txt_username"></span>
                        </td>
                      </tr>
                      {/if}

                      <tr>
                        <th scope="row">{if $type=='about'}外链{else}{$_lang['from']} {/if}{$_lang['zh_mh']}</th>
                        <td><input type="text" class="txt" style=" width:260px;"
						name="fields[art_source]"
						id="art_source"
						value="$art_source"
                        			 limit = "required:false"
                                     msg = '{$_lang['choose_from']}'
                                     title='{if $type=='art'}{$_lang['article']}{elseif $type=='help'}{$_lang['help']}{elseif $type=='bulletin'}{$_lang['bulletin']}{elseif $type=='about'}{$_lang['about']}{else}{$_lang['single_page']}{/if}{$_lang['from_where']}{$_lang['zh_wh']}'
                                     msgArea="msg_art_source"/><span id="msg_art_source"></span>{if $type=='about'}(请填写有效的外部链接。格式：http://www.exprience.com){/if}
                       </td>
                      </tr>
                      {if $type!='help'&&$type!='about'}
					  <tr>
                        <th scope="row">{$_lang['is_recommend']}{$_lang['zh_mh']}</th>
                        <td>
                          <p>
                              <label for="cbk"><input type="checkbox" name="fields[is_recommend]" id="cbk" value="1"  {if $art_info['is_recommend']==1} checked="checked"   {else} {/if}/>&nbsp;{$_lang['yes']}</label> <br />
                          </p>
                        </td>
                      </tr>
                      {/if}


					  {if $type=='art'}
                      <tr>
                        <th scope="row">{$_lang['upload_image']}:</th>
                        <td>
                       	<div id="picker">上传图片</div>
                       	<input type="hidden"  name="fileid" id="fileid"  class="form-control" value="">
                       	<input type="hidden"  name="filepath" id="filepath"  class="form-control" value="{$art_info['art_pic']}">
                       	 <img id="idpic_img" src="$art_info['art_pic']" {if !$art_info['art_pic']}style="display:none"{/if} width="200">
                       	 <ul class="affix-list upload-file-list-info" style="width:280px;" id="fileList"></ul>
                       	 </td>
                      </tr>
					  {/if}

				       <tr>
                     <th scope="row">{if $type=='art'}{$_lang['article']}{elseif $type=='help'}{$_lang['help']}{elseif $type=='bulletin'}{$_lang['bulletin']}{elseif $type=='about'}页脚{else}{$_lang['single_page']}{/if}{$_lang['content']}{$_lang['zh_mh']}</th>
                       <td>
                        <textarea rows="30" name="fields[content]" id="tar_content"  cols="70"><!--{eval echo stripslashes($art_info['content'])}--></textarea>
					</td>
					 </tr>
					 <script type="text/javascript" src="{$_K['siteurl']}/static/js/ueditor/ueditor.config.admin.js"></script>
					<!-- 编辑器源码文件 -->
					<script type="text/javascript" src="{$_K['siteurl']}/static/js/ueditor/ueditor.all.min.js"></script>
					<script type="text/javascript" src="{$_K['siteurl']}/static/js/ueditor/lang/zh-cn/zh-cn.js"></script>
					 <!-- 实例化编辑器 -->
				    <script type="text/javascript">
				        var ue = UE.getEditor('tar_content', {
				            //这里可以选择自己需要的工具按钮名称,此处仅选择如下五个
				        	initialFrameWidth: '80%',
				        	initialFrameHeight: '400'
				        });
				    </script>

					 {if $type=='art'|| $type=='about'}
                     <tr>
                        <th scope="row">SEO{$_lang['title']}{$_lang['zh_mh']}</th>
                        <td><textarea cols="70" rows="2"  name="fields[seo_title]" value="{$art_info['seo_title']}">{$art_info['seo_title']}</textarea></td>
                     </tr>

                     <tr>
                        <th scope="row">SEO{$_lang['keywords']}{$_lang['zh_mh']}</th>
                        <td><textarea cols="70" rows="2"  name="fields[seo_keyword]" value="{$art_info['seo_keyword']}">{$art_info['seo_keyword']}</textarea></td>
                     </tr>

                      <tr>
                        <th scope="row">SEO{$_lang['description']}{$_lang['zh_mh']}</th>
                        <td><textarea cols="70" rows="3" name="fields[seo_desc]" value="{$art_info['seo_desc']}">{$art_info['seo_desc']}</textarea></td>
                     </tr>
                     {/if}



					{if $art_info['pub_time']}
					 <tr>
                        <th scope="row">{$_lang['last_modify']}{$_lang['zh_mh']}</th>
                        <td><!--{date('Y-m-d H:i:s',$art_info['pub_time'])}--></td>
                     </tr>
                    {/if}

                    <tr>
                        <th scope="row">&nbsp;</th>
                    	<td>
                    	<button name="sbt_edit" value="1" onclick="return checkForm(document.getElementById('frm_art_edit'),false)" class="positive primary pill button" type="submit">
                    	<span class="check icon"></span>{$_lang['submit']}</button>

                    	</td>
                    </tr>
                    </table>
                </form>
              </div>
       </div>
</div>
<!--主体结束-->

<!-- <script src="../static/js/uploadify/jquery.uploadify.min.js?r={RANDOM_PARA}" type="text/javascript"></script>
<link href="../static/js/uploadify/uploadify.css" rel="stylesheet"> -->
<!--{template ADMIN_DIRECTORY/tpl/admin_footer}-->
<script type="text/javascript">
$(function(){
    var c_id = parseInt("$art_info['art_cat_id']");
    if (c_id) {
        $("#slt_cat_id").val(c_id);
    }

    $("input[name='sbt_edit']").click(function(){
        var si = $("#slt_cat_id").val();
        if (!si) {
            $("#msg_cat_id").html("{$_lang['choose_category']}");
            return false;
        }
        else {
            $("#msg_cat_id").html("{$_lang['category_has_been_selected']}");
            return true;
        }
    })
})


</script>
<script type="text/javascript">
	//指定网站URL，后台是必须要定义的，前台不必定义
	var baseurl = "{$basic_config['website_url']}";
	var uploadsize = parseInt("{$basic_config['max_size']}");
		uploadsize =  isNaN(uploadsize)? 1 : uploadsize;
	var QNopen = "{QN_UPLOAD_OPEN}";
	$(function(){
		$("#picker").KKUploader({
				accept: {
					extensions : 'jpg,gif,png,jpeg'  //可上传文件格式
				},
				fileNumLimit:1,			//上传数量限制
				hiddenName:'fileid',	//表单隐藏域id
				uploadEvents: {
					uploadComplete:function(file){
						var url = $("#"+file.id).find('.webuploader-pick-file-close').attr('data-fileurl');
						if(QNopen != 1){
							$("#filepath").val('../'+url);
		                    $('#idpic_img').prop('src','../'+url);
						} else {
							$("#filepath").val(url);
	                    	$('#idpic_img').prop('src',url);
						}
						$("#idpic_img").show();
	                    $('.webuploader-pick-file-close').on('click','.close',function(){
	                    	$("#filepath").val("");
							$("#idpic_img").hide();
						});
					}
				},
				listName: 'fileList',
				fileSingleSizeLimit:uploadsize*1024*1024			//上传大小限制
			},
			{
				filename : 'file',//传递给服务端的参数指定上传文本域的name，如果未指定，上传不成功
			});
	});
</script>
<link rel="stylesheet" type="text/css" href="tpl/js/webuploader/webuploader.css">
<script type="text/javascript" src="../static/js/jquery.min.js?r={RANDOM_PARA}"></script>
<script type="text/javascript" src="tpl/js/webuploader/webuploader.js?r={RANDOM_PARA}"></script>
<script type="text/javascript" src="tpl/js/webuploader/kppw.webuploader.js"></script>


